
#ifndef __G3DVEC_H__
#define __G3DVEC_H__ 1

#include "glodef.h"
#include "grid3d.h"     /* definition of grid3d_t */
#include "vecs.h"     /* definition of vector and scalar */

#ifdef	__cplusplus
extern "C" {
#endif



void ConvertP1toCR(grid3d_t *grid, const vector P1, vector CR);

/* norms ********************************************************************/
double norm_vec_diff_l2_p1(const grid3d_t *grid, const vector v1,
        const vector v2);
double norm_vec_diff_h1_p1(const grid3d_t *grid, const vector v1,
        const vector v2);
double norm_vec_diff_l2_cr(const grid3d_t *grid, const vector v1,
        const vector v2);
double norm_vec_diff_h1_cr(const grid3d_t *grid, const vector v1,
        const vector v2);

double norm_scal_diff_l2_p1(const grid3d_t *grid, const scalar v1,
        const scalar v2);
double norm_scal_diff_h1_p1(const grid3d_t *grid, const scalar v1,
        const scalar v2);
double norm_scal_diff_l2_cr(const grid3d_t *grid, const scalar v1,
        const scalar v2);
double norm_scal_diff_h1_cr(const grid3d_t *grid, const scalar v1,
        const scalar v2);

/* ***** ********************************************************************/

void test_div_cr(const grid3d_t *grid, int test_bdrt, const vector v, scalar p);
void test_grad_cr(const grid3d_t *grid, int test_bdrt, const scalar p, vector v);

/* ***** ********************************************************************/

void convert_xyz2tsn(const grid3d_t *grid, const vector xyz, vector tsn);
void convert_tsn2xyz(const grid3d_t *grid, const vector tsn, vector xyz);
void convert_xyz2tsdf(const grid3d_t *grid, const vector xyz, double *tsdf);

// void AssembleGravity(grid3d_t *grid, vector G);

#ifdef	__cplusplus
}
#endif


#endif
